<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="css/login.css"/>
    <script src="js/jquery.min.js"></script>
</head>
<body scroll="no" style="overflow-x:hidden;overflow-y:hidden;" onkeydown="keyLogin();">
<div class="loginWrapper">
<div class="banWrapper " >
    <div class="" >
        <a href=""><img src="img/timg3.png" alt="" style="position: fixed;height: 100%;width: 100%"/></a>
    </div>

</div>
</div>
<div class="loginMain" style="background: white">
    <div class="loginWidth" style="">
        <div class="loginLogoDiv">
            <a href="" class="loginLogo"></a>
        </div>
        <from class="fromLogin">
           <div class="loginList loginUser">
               <label></label>
               <input type="text" class="loginText" name="name" id="name" placeholder="用户名/手机号/邮箱"/>
           </div>
            <div class="loginList loginPwd">
                <label style="position: absolute;top:25px"></label>
                <input type="text" class="loginText" name="pwd" id="pass" placeholder="密码"/>
            </div>
            <p class="loginList" style="border-bottom: none;text-align: right;color: #03c5ff"><a href="forgetpwd.html" style="text-decoration: none;color: #fff;font-weight: bold">忘记密码?</a></p>
            <input class="loginbtn" id="dl" type="button" name="button" value="登录"/>
            <p class="have"><span style="color: #fff">还没有账号?</span>,<a href="register.html" style="color: #fff"><b>立即注册</b></a></p>
        </from>
    </div>
</div>
<!--<script>
    $(document).ready(function () {
        $("#dl").click(function () {
          // alert(123)


            //alert(name)
            if ($("input[name='name']").val() == "") {
                alert("用户名不能为空");
                return false;
            }
            else if ($("input[name='pwd']").val() == "") {
                alert("密码不能为空");

                return false;
            }
            /* else if ($("input[name='validation']").val() == "") {
             alert("验证码不能为空");
             return false;
             }*/

            else {
                $.ajax({
                    type: "post",
                    url: "http://120.24.1.213:8080/data/servlet/web_login",
                    async: false,
                    data: {
                        name: $("input[name='name']").val(),
                        pwd: $("input[name='pwd']").val()
                        // Code: $("input[name='validation']").val()
                    },
                    success: function (data, status) {
                        var types = data;
                        if (types.toString() != "登录成功") {
                            alert(data);

                            //sessionStorage.setItem('name', name);
                        }
                        else{

                        }
                    },
                    error: function () {
                        //alert("登录失败")

                        window.location.href="indexapi.html";
                        var name=$("#name").val();
                        localStorage.setItem("name", name);

                    }

                });
            }
        });
    });
</script>-->
<script>
    document.getElementById("dl").onclick=function() {
        var name = document.getElementById("name").value;
        var pass = document.getElementById("pass").value;
        if(name == "" || name == null) {
            alert("请输入手机号！");
            return;
        } else if(pass == "" || pass == null) {
            alert("请输入密码！");
            return;
        }  else {
            $.ajax('http://120.24.1.213:8080/web_juhe/servlet/Login', {
                data: {
                    userName: name,
                    pwd: pass
                },
                dataType: 'json',
                type: 'post',
                timeout: 10000,
                success: function(data) {
                    if(data.code == 0000) {
                        //alert(6)
                        window.location.href="appstate.html";
                        var name=$("#name").val();
                        localStorage.setItem("name", name);
                        //localStorage.setItem("perId", data.result.date.perId);
                    } else {
                        alert("您的帐号或密码错误，请仔细核对后重新输入！")
                    }
                },
                error: function(xhr, type, errorThrown) {
                    console.log(type);
                    return;
                }
            });
        }
    };

</script>
<script>
    function keyLogin(){
        if (event.keyCode==13)  //回车键的键值为13
            document.getElementById("dl").click(); //调用登录按钮的登录事件
    }
</script>

</body>
</html>